﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrowserGameFramework.Units;

namespace BrowserGameFramework.Units.Battle
{
    class BattleHelper
    {
        /// <summary>
        /// Determines whether [is able to arrack] [the specified unit1].
        /// </summary>
        /// <param name="unit1">The unit1.</param>
        /// <param name="unit2">The unit2.</param>
        /// <example>If a Goundunit try to attack an aircraft, the value is false</example>
        /// <returns>
        /// 	<c>true</c> if [is able to arrack] [the specified unit1]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsAbleToArrack(Unit unit, Unit target)
        {
            if (unit.AttackType == target.AttackType)
            {
                return true;
            }

            if (unit.AttackType == UnitEnums.AttackTypes.Air)
            {
                return true;
            }

            if (unit.AttackType == UnitEnums.AttackTypes.LongRange)
            {
                return true;
            }

            if(unit.AttackType == UnitEnums.AttackTypes.ShortRange && (target.AttackType == UnitEnums.AttackTypes.Air ||target.AttackType == UnitEnums.AttackTypes.Bombardemend || target.AttackType == UnitEnums.AttackTypes.Sea))
            {
                return false;
            }

            return false;

        }
    }
}
